<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="/common/header::commonHead(${title})">
</head>
<body>
<div class="agileits-modal modal fade" id="myModal88" tabindex="-1" role="dialog" aria-labelledby="myModal88"
     aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel"><i class="fa fa-map-marker" aria-hidden="true"></i> Location
                </h4>
            </div>
            <div class="modal-body modal-body-sub">
                <h5>Select your delivery city & location </h5>
                <select class="form-control bfh-states" data-country="US" data-state="CA">
                    <option value="">Select Your Country</option>
                    <option value="AL">Alabama</option>
                    <option value="AK">Alaska</option>
                    <option value="AS">American Samoa</option>
                    <option value="AZ">Arizona</option>
                    <option value="AR">Arkansas</option>
                    <option value="AF">Armed Forces Africa</option>
                    <option value="AA">Armed Forces Americas</option>
                    <option value="AC">Armed Forces Canada</option>
                    <option value="AE">Armed Forces Europe</option>
                    <option value="AM">Armed Forces Middle East</option>
                    <option value="AP">Armed Forces Pacific</option>
                    <option value="CA">California</option>
                    <option value="CO">Colorado</option>
                    <option value="CT">Connecticut</option>
                    <option value="DE">Delaware</option>
                    <option value="DC">District of Columbia</option>
                    <option value="FM">Federated States Of Micronesia</option>
                    <option value="FL">Florida</option>
                    <option value="GA">Georgia</option>
                    <option value="GU">Guam</option>
                    <option value="HI">Hawaii</option>
                    <option value="ID">Idaho</option>
                    <option value="IL">Illinois</option>
                    <option value="IN">Indiana</option>
                    <option value="IA">Iowa</option>
                    <option value="KS">Kansas</option>
                    <option value="KY">Kentucky</option>
                    <option value="LA">Louisiana</option>
                    <option value="ME">Maine</option>
                    <option value="MH">Marshall Islands</option>
                    <option value="MD">Maryland</option>
                    <option value="MA">Massachusetts</option>
                    <option value="MI">Michigan</option>
                    <option value="MN">Minnesota</option>
                    <option value="MS">Mississippi</option>
                    <option value="MO">Missouri</option>
                    <option value="MT">Montana</option>
                    <option value="NE">Nebraska</option>
                    <option value="NV">Nevada</option>
                    <option value="NH">New Hampshire</option>
                    <option value="NJ">New Jersey</option>
                    <option value="NM">New Mexico</option>
                    <option value="NY">New York</option>
                    <option value="NC">North Carolina</option>
                    <option value="ND">North Dakota</option>
                    <option value="MP">Northern Mariana Islands</option>
                    <option value="OH">Ohio</option>
                    <option value="OK">Oklahoma</option>
                    <option value="OR">Oregon</option>
                    <option value="PW">Palau</option>
                    <option value="PA">Pennsylvania</option>
                    <option value="PR">Puerto Rico</option>
                    <option value="RI">Rhode Island</option>
                    <option value="SC">South Carolina</option>
                    <option value="SD">South Dakota</option>
                    <option value="TN">Tennessee</option>
                    <option value="TX">Texas</option>
                    <option value="UT">Utah</option>
                    <option value="VT">Vermont</option>
                    <option value="VI">Virgin Islands</option>
                    <option value="VA">Virginia</option>
                    <option value="WA">Washington</option>
                    <option value="WV">West Virginia</option>
                    <option value="WI">Wisconsin</option>
                    <option value="WY">Wyoming</option>
                </select>
                <input type="text" name="Name" placeholder="Enter your area / Landmark / Pincode" required="">
                <button type="button" class="close2" data-dismiss="modal" aria-hidden="true">Skip & Explore</button>
            </div>
        </div>
    </div>
</div>
<div th:replace="/common/nav::nav">
</div>

<!-- 内容开始处 -->
<!-- sign up-page -->
<style>
    .login-page input[type="button"] {
        border: none;
        outline: none;
        cursor: pointer;
        color: #fff;
        background: #0280e1;
        width: 100%;
        padding: .8em 1em;
        font-size: 1em;
        margin: 0.5em 0 0;
        -webkit-transition:.5s all;
        -moz-transition:.5s all;
        -o-transition:.5s all;
        -ms-transition:.5s all;
        transition:.5s all;
        text-transform: uppercase;
        -webkit-appearance:none;
    }
    .login-page input[type="button"]:hover {
        background: #137288;
        letter-spacing: 5px;
    }
    .login-page label.checkbox {
        float: left;
        margin: 0;
    }
</style>
<div class="login-page">
    <div class="container">
        <h3 class="w3ls-title w3ls-title1">Login to your account</h3>
        <div class="login-body">
            <form action="#" method="post" id="login_form">
                <input type="text" class="user" name="phone" placeholder="Enter your phone" required="">
                <input type="password" name="password" class="lock" placeholder="Password" required="">
                <input type="button" class="handle_btn" value="LOGIN ">
                <div class="forgot-grid">
                    <label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Remember me</label>
                    <div class="forgot">
                        <a href="#">Forgot Password?</a>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </form>
        </div>
        <h6>Don't have an account? <a th:href="@{/login/register}">Sign up Now »</a></h6>
    </div>
</div>
<!-- //sign up-page -->


<div th:replace="/common/footer::onloadJs"></div>
<script type="text/javascript">
    ;(function ($) {
        var index_function = function () {
            var self = this;
            this.body = $(document.body);
            this.body.delegate(".handle_btn", "click", function () {
                self.login();
            });
            $("#login_form input").keydown(function (e) {
                if(e.keyCode == 13){
                    setTimeout(function () {
                        self.login();
                    }, 10);
                }
            });
            // this.test();
        };
        index_function.prototype = {
            test: function () {
                yy_init("model");
            },
            login:function () {
                var self = this;
                var formData = getFormData("login_form");
                try{
                    if(formData == 1){
                        yy_init("请完善信息");
                        return;
                    }
                }catch (e){
                    console.log(e);
                }
                $.ajax({
                    url:"/login/loginHandle",
                    type:"POST",
                    dataType:"json",
                    data:{"username":formData[1][0], "password":formData[1][1]},
                    success:function (data) {
                        if(data.text == "ok"){
                            yy_init("登录成功");
                            location.href = "/index/index";
                        }else{
                            yy_init(data.text);
                        }
                    },
                    error:function (data, status, e) {
                        console.log(e);
                    }
                });
            }
        }
        window['index_function'] = index_function;
    })(jQuery);
    $(function () {
        var index = new index_function();
    });
</script>
</body>
</html>